package com.dushibao.manage.article;

import com.dushibao.entity.Article;
import com.dushibao.service.ArticleService;
import com.dushibao.service.impl.ArticleServiceImpl;
import com.dushibao.view.ModelAndView;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@WebServlet("/article/show")
public class ShowServlet extends HttpServlet {
    ArticleService articleService = new ArticleServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");

        Article article = articleService.getById(Long.parseLong(id));

        Map<String,Object> maps = new HashMap<>();
        maps.put("article",article);

        ModelAndView mv = new ModelAndView("website/article/show",maps);

    }
}
